package com.caregiver.watch.business.care.model.dto;

import com.caregiver.watch.business.user.enums.CareRelationshipEnum;
import com.caregiver.watch.business.user.model.po.UserCareRecipient;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDate;

/**
 * @Description: 修改被照护人
 * @Author 疆戟
 * @Date 2025/8/30 15:03
 * @Version 1.0
 */
@Data
@Schema(description = "修改被照护人")
public class UpdateCareRecipientParam {

    /**
     * 被照护人ID
     */
    @Schema(description = "被照护人ID")
    private Long recipientId;

    /**
     * 被照护人姓名
     */
    @Schema(description = "被照护人姓名")
    private String recipientName;

    /**
     * 与用户关系（本人、父亲、母亲、配偶等）
     */
    @Schema(description = "与用户关系（本人、父亲、母亲、配偶等）")
    private CareRelationshipEnum relationship;

    /**
     * 联系电话
     */
    @Schema(description = "联系电话")
    private String phoneNumber;

    /**
     * 性别（0-未知 1-男 2-女）
     */
    @Schema(description = "性别（0-未知 1-男 2-女）")
    private Integer gender;

    /**
     * 出生日期
     */
    @Schema(description = "出生日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDate birthday;

    /**
     * 腕围
     */
    @Schema(description = "腕围")
    private Integer wristCircumference;

    /**
     * 身高
     */
    @Schema(description = "身高")
    private Integer height;

    /**
     * 体重
     */
    @Schema(description = "体重")
    private Integer weight;



    public UserCareRecipient toPo(Long userId) {
        UserCareRecipient userCareRecipient = new UserCareRecipient();
        userCareRecipient.setRecipientId(this.recipientId);
        userCareRecipient.setUserId(userId);
        userCareRecipient.setName(this.recipientName);
        userCareRecipient.setRelationship(relationship.name());
        userCareRecipient.setPhoneNumber(this.phoneNumber);
        userCareRecipient.setGender(this.gender);
        userCareRecipient.setBirthday(this.birthday);
        userCareRecipient.setWristCircumference(this.wristCircumference);
        userCareRecipient.setHeight(this.height);
        userCareRecipient.setWeight(this.weight);
        return userCareRecipient;
    }
}
